KVCache

interface KVCache<K, V> : KeyValueRepo<K, V>

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open suspend fun clear()

By default, will remove all the data of current repo using doAllWithCurrentPaging, keys and unset

Link copied to clipboard
abstract suspend fun contains(key: K): Boolean
Link copied to clipboard
abstract suspend fun count(): Long
Link copied to clipboard
abstract suspend fun get(k: K): V?
Link copied to clipboard
abstract suspend fun keys(pagination: Pagination, reversed: Boolean = false): PaginationResult<K>
abstract suspend fun keys(    v: V,     pagination: Pagination,     reversed: Boolean = false): PaginationResult<K>

This method should use sorted by Keys search and take the PaginationResult. By default, it should use ascending sort for Keys

Link copied to clipboard
abstract suspend fun set(toSet: Map<K, V>)

Will set as batch toSet data in current repo. Must pass the data which were successfully updated in repo to onNewValue

Link copied to clipboard
abstract suspend fun unset(toUnset: List<K>)

Will unset as batch data with keys from toUnset. Must pass the Keys which were successfully removed in repo to onValueRemoved

Link copied to clipboard
open suspend override fun unsetWithValues(toUnset: List<V>)

By default, will walk throw all the keys with Values from toUnset and run doAllWithCurrentPaging with unset of found data Keys

Link copied to clipboard
abstract suspend fun values(pagination: Pagination, reversed: Boolean = false): PaginationResult<V>

This method should use sorted by Keys search and take the PaginationResult. By default, it should use ascending sort for Keys

Properties

Link copied to clipboard
abstract val onNewValue: Flow<Pair<K, V>>

This flow must emit data each time when data by Key has been changed with set method or in any other way excluding cases of data removing

Link copied to clipboard
abstract val onValueRemoved: Flow<K>

This flow must emit data each time when data by Key has been removed with unset/unsetWithValues methods or in any other way

Inheritors

FullKVCache
Link copied to clipboard
SimpleKVCache
Link copied to clipboard